package com.stepbystep.thread.blockingqueue;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

public class Writer implements Runnable {
	public LinkedBlockingQueue<String> queue;

	public Writer(LinkedBlockingQueue<String> queue) {
		this.queue = queue;
	}

	public void run() {
		int i=0;
		while(true){
			i++;
			try {
				queue.put(""+i);
				System.out.println("put:"+i);
				TimeUnit.MICROSECONDS.sleep(10);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
